Skip to content

Re-accept hyphen-delimited hook sections with deprecation warning#89

Merged
jensens merged 1 commit into
mainfrom
fix/hook-namespace-hyphen-deprecation
May 30, 2026
Merged

Re-accept hyphen-delimited hook sections with deprecation warning#89
jensens merged 1 commit into
mainfrom
fix/hook-namespace-hyphen-deprecation

Conversation

@jensens
Copy link
Copy Markdown
Member

@jensens jensens commented May 30, 2026

Summary

5.3.1 anchored hook section matching strictly on :, which broke downstream hooks (notably mxmake) that emit [namespace-section] sections — those sections were reclassified as packages and tripped ValueError("Section X has no URL set!") on the first mxdev run after upgrade.

This PR re-accepts the historical - delimiter for backward compatibility, logs a one-time deprecation warning per offending section, and normalizes hook namespaces that bake a trailing - into the namespace string (e.g. namespace = "mxmake-").

Recognized hook section forms:

Form Status
[namespace] exact match, canonical
[namespace:subsection] colon delimiter, canonical
[namespace-subsection] hyphen delimiter, deprecated, logs warning

The original #88 bug stays fixed: a package whose name merely starts with the namespace without a delimiter (e.g. uvst.addon for namespace "uv") is still a package, not a hook section.

Why

mxmake declares namespace = "mxmake-" and emits [mxmake-env], [mxmake-<template>] sections in every generated mx.ini. Under 5.3.1 these are misclassified as packages → hard-fail. Rather than force every downstream user to regenerate their mx.ini in lockstep with 5.3.1, accept the old form with a deprecation pointing users at the new syntax.

A separate issue will be filed against mxstack/mxmake to plan the migration to colon syntax.

Test plan

  • test_hook_section_with_hyphen_delimiter_is_supported_but_deprecated[mxmake-env] is a hook section AND a deprecation warning is logged
  • test_legacy_namespace_with_trailing_hyphen_is_normalizednamespace = "mxmake-" works for both [mxmake-env] and [mxmake:files]
  • test_hyphen_prefix_without_delimiter_is_still_a_packageuvst.addon regression from Fix hook namespace swallowing packages with a matching name prefix #88 still holds
  • test_hook_section_with_namespace_delimiter_belongs_to_hook — colon form still works
  • Full suite: 215 passed, 4 skipped
  • tox -e lint passes

5.3.1 anchored hook section matching strictly on ":", which broke
downstream hooks (notably mxmake) that emit [namespace-section] sections.
Re-accept the historical "-" delimiter for backward compatibility, log a
one-time deprecation warning per offending section, and normalize hook
namespaces that bake a trailing "-" into the namespace string itself
(e.g. namespace = "mxmake-").

Recognized hook section forms (in order of preference):
  [namespace]              exact match
  [namespace:subsection]   colon delimiter, canonical
  [namespace-subsection]   hyphen delimiter, deprecated, logs warning

The original bug stays fixed: a package whose name merely starts with the
namespace without a delimiter (e.g. uvst.addon for namespace "uv") is
still a package, not a hook section.
@jensens jensens merged commit adfd17e into main May 30, 2026
17 checks passed
@jensens jensens deleted the fix/hook-namespace-hyphen-deprecation branch May 30, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant